package com.example.monitor.model.enums;

public enum WorkerStatus {
    ACTIVE("active", "在职"),
    INACTIVE("inactive", "离职");

    private final String code;
    private final String description;

    WorkerStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static WorkerStatus fromCode(String code) {
        for (WorkerStatus status : WorkerStatus.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid worker status code: " + code);
    }
}
